<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/WEB-INF/jsp/commons/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>E-天下商旅</title>

<link href="${ctx}/resources/css/page_operat.css" rel="stylesheet" type="text/css">
</head>

<body>
  <body>

<jsp:include page="../commons/header.jsp" >
	 <jsp:param name="currentMenu" value="menu2"/>
</jsp:include>



<div class="main_box">
<div class="main cf">

	<jsp:include page="../commons/left.jsp"></jsp:include>
<div class="right">
		<div class="right_box">
			<div class="title"><span><a href="#">我的档案</a></span></div>
			<div class="content cf">
				<div class="change_title">修改${num}级密码</div>
				<div class="change_box">
					<form action="${ctx}/memberBI/updatePassword?type=${type}" method="post">
                        <div>
							<label><i>* </i>输入原密码</label>
                            <input type="password" class="input" name="pwd" id="pwd" /><span></span>
                        </div>
                        <div>
							<label><i>* </i>输入新密码</label>
                            <input type="password" class="input password1" name="newPwd" id="newPwd" /><span></span>
                        </div>
                        <div>
							<label><i>* </i>再次输入新密码</label>
                            <input type="password" class="input password2" name="newPwdAgain"  /><span></span>
                        </div>
                        <div>
 							<label>&nbsp;</label>
							<input type="submit" class="submit btn_orange" value="确定" />&nbsp;&nbsp;<a href="${ctx}/memberBI/myprofile" class="btn_blue"/>返回</a>
                        </div>
					</form>
				</div>
			</div>
		</div>
	</div>
		
</div>
</div>

<jsp:include page="/WEB-INF/jsp/commons/footer.jsp"></jsp:include>

<script src="${ctx}/resources/script/validate/jquery-1.4.min.js" type="text/javascript"></script>
<script src="${ctx}/resources/script/common.js"></script>
<script type="text/javascript" src="${ctx}/resources/script/validate/jquery.validate.js"></script>
<script type="text/javascript" src="${ctx}/resources/script/validate/jquery.metadata.js"></script>
<script type="text/javascript" src="${ctx}/resources/script/validate/additional-methods.js" charset="utf-8"></script>
<script type="text/javascript" src="${ctx}/resources/script/validate/messages_cn.js" charset="utf-8"></script>
<script type="text/javascript">
//$.validator.setDefaults({
//	submitHandler: function() { alert("submitted!"); }
//});

// 添加验证方法 (身份证号码验证)
jQuery.validator.addMethod("equalsPwd", function(value, element) {   
		return this.optional(element) || equalsPwd(value);   
}, "请输入相同的密码"); 

function equalsPwd(value){
	alert(value+"----"+$("#newPwd").attr("value"));
	return value==$("#newPwd").val();
}

$(function(){
	$("form").validate({
		rules:{
			pwd:{
				required:true,
				rangelength:[6,20],
				remote:{
			        url: "${ctx}/memberBI/lookPassword?type=${type}", //后台处理程序    
			        type:"post",
			        dataType: "json",       //接受数据格式      
			        data:  {                     //要传递的数据   
			            password: function() {   
			        				return $("#pwd").val();   
			        	  		  }		  
			        }   

				}
			},
			newPwd:{
				required:true,
				rangelength:[6,20]	
			},
			newPwdAgain:{
				required:true,
				equalTo:"#newPwd"
			}
		},
		errorPlacement : function(error, element) {
			error.appendTo(element.next("span"));
		},
		 messages:{    
			 pwd:{    
			     remote:"密码不正确"    
			     } 
		  }   
	});
 });
</script>

</body>
</html>

